$OpenBSD: patch-src_gtkutils_c,v 1.2 2015/01/29 07:07:39 rpointel Exp $

issue 215: http://sylpheed.sraoss.jp/redmine/issues/215
Fixed upstream: http://sylpheed.sraoss.jp/redmine/projects/sylpheed/repository/revisions/3462/diff/src/gtkutils.c

--- src/gtkutils.c.orig	Tue Jun 10 06:06:36 2014
+++ src/gtkutils.c	Thu Jan 29 07:19:22 2015
@@ -915,7 +915,7 @@ void gtkut_text_buffer_insert_with_tag_by_name(GtkText
 	gtk_text_buffer_insert_with_tags_by_name
 		(buffer, iter, text, len, tag, NULL);
 
-	if (text[len - 1] != '\n') {
+	if (len > 0 && text[len - 1] != '\n') {
 		/* somehow returns invalid value first (bug?),
 		   so call it twice */
 		gtk_text_iter_get_chars_in_line(iter);
